import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/sys/login',
    method: 'post',
    data
  })
  .then(res => {
  // console.log(res)
  localStorage.setItem('hrm_token', `Bearer ${res.data.data}`);
  return res;
  })
  .catch(err => Promise.reject(err.response.data.message))
}

export function getInfo(token) {
  return request({
    url: '/vue-element-admin/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-element-admin/user/logout',
    method: 'post'
  })
}
